/*
 * interface.c
 *
 * Created: 4/23/2012 4:24:03 AM
 *  Author: Ajay
 */ 

#include <avr/io.h>
#include <string.h>
#include <stdio.h>

#include <util/delay.h>
#include <spi.h>
#include <types.h>
#include <w5100.h>


#define F_CPU 16000000L
#define __DEF_IINCHIP_BUS__ __DEF_IINCHIP_SPI_MODE__ 

  unsigned char mac_addr[] = {0x00,0x16,0x36,0xDE,0x58,0xF6};
  unsigned char ip_addr[] = {192,168,1,2};
  unsigned char sub_mask[] = {255,255,255,0};
  unsigned char gtw_addr[] = {192,168,1,1};
  unsigned char dest_addr[] = {192,168,1,1};
int main(void)
{
	SPI0_Init();
	setMR(0x80);
	setGAR(gtw_addr);
	setSHAR(mac_addr);
	setSUBR(sub_mask);
	setSIPR(ip_addr);
	sysinit(01,01);
	socket(0, Sn_MR_UDP, 8888, Sn_MR_UDP);
			char buffer = "100000";
			char length = strlen((char *)buffer);
    while(1)
    {
	
        sendto(0, buffer, strlen((char *)buffer), dest_addr, 8888);
    }
}